package org.mendoza.salud.hvt.client.shared.model.global;


import org.jboss.errai.common.client.api.annotations.Portable;
import org.jboss.errai.databinding.client.api.Bindable;
import org.mendoza.salud.hvt.client.shared.model.AbstractEntity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 * Created by ricardo on 03/01/14.
 */
@Entity
@Portable
@Bindable
@NamedQueries({
        @NamedQuery(name = "pais.all", query = "select p from Pais p"),
        @NamedQuery(name = "pais.by.nombre", query = "select p from Pais p where p.nombre=:nombre"),
        @NamedQuery(name = "pais.by.nombre.like", query = "select p from Pais p where p.nombre like :nombre")
})
public class Pais extends AbstractEntity {
    public Pais(){}

    @NotNull
    @Column(unique = true)
    private String nombre;
    @NotNull @Size(min = 2, max = 2)
    private String codigoAlfa2;
    @NotNull @Size(min = 3, max = 3)
    @Column(unique = true)
    private String codigoAlfa3;
    @NotNull
    @Column(unique = true)
    private Integer codigoNumerico;

    @Override
    public String toString() {
        return getNombre();    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getCodigoAlfa2() {
        return codigoAlfa2;
    }

    public void setCodigoAlfa2(String codigoAlfa2) {
        this.codigoAlfa2 = codigoAlfa2;
    }

    public String getCodigoAlfa3() {
        return codigoAlfa3;
    }

    public void setCodigoAlfa3(String codigoAlfa3) {
        this.codigoAlfa3 = codigoAlfa3;
    }

    public Integer getCodigoNumerico() {
        return codigoNumerico;
    }

    public void setCodigoNumerico(Integer codigoNumerico) {
        this.codigoNumerico = codigoNumerico;
    }
}
